Skip to content

feat: add GqlSubscription and WebSocket subscribe support (v3.8.4)#184

Merged
PHKenny merged 3 commits into
mainfrom
development
Apr 23, 2026
Merged

feat: add GqlSubscription and WebSocket subscribe support (v3.8.4)#184
PHKenny merged 3 commits into
mainfrom
development

Conversation

@PHKenny
Copy link
Copy Markdown
Contributor

@PHKenny PHKenny commented Apr 23, 2026

📋 Summary

  • Extends the gql_builder module with a GqlSubscription class so callers can compose GraphQL subscription documents the same way they build queries and mutations.
  • Adds LayrzConnector.subscribe() to open a real-time WebSocket connection using the graphql-transport-ws protocol and return a typed Stream<Map<String, dynamic>>.
  • Bumps package to v3.8.4.

📝 Changes

✨ Features

  • Added GqlSubscription class (lib/src/api/src/gql_builder/gql.dart) — mirrors GqlQuery/GqlMutation and emits the subscription keyword in the generated document.
  • Fixed Gql.generated to always emit the opening { brace regardless of whether variables are present (was missing the brace when variables list was empty).
  • Added LayrzConnector.subscribe(GqlSubscription) (lib/src/api/src/api_connector.dart) — negotiates graphql-transport-ws, sends connection_init with auth headers, streams next payloads, and sends complete on stream cancel.

🔧 Chore / Config

  • Added web_socket_channel: ^3.0.1 dependency.
  • Bumped version to 3.8.4 and updated CHANGELOG.md.

🤖 Generated with Claude Code

PHKenny and others added 3 commits April 22, 2026 18:27
…nector

Introduce GqlSubscription class alongside GqlQuery/GqlMutation, update
the gql builder to emit `subscription` keyword, and implement
LayrzConnector.subscribe() using the graphql-transport-ws protocol over
WebSocketChannel.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Required for WebSocket-based GraphQL subscription support.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

📋 Changelog Summary

This PR includes the following changes:

✨ Features

  • add GqlSubscription and WebSocket subscribe support to LayrzConnector (574c042 by @PHKenny, Claude Sonnet 4.6)

🤖 Auto-generated by changelog workflow

@github-actions
Copy link
Copy Markdown

📊 Test Coverage Report

🎯 Dart/Flutter

Metric Value
Coverage 10.5%
Lines covered 14876 / 448
Lines missing -14428

🤖 Generated by coverage workflow

@PHKenny PHKenny merged commit 8b425cd into main Apr 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant